<?php

/**
 * 客栈信息表模型
 */
class InnRoomModel extends AutoMapModel {

    protected $tableName = 'hotelroom';
    public $_map = array(
        'id'              => 'hotelroom0', //房型ID
        'name'            => 'hotelroom1', //房型名称
        'innId'           => 'hotelroom2', //所属酒店id
        'menuId'          => 'hotelroom3', //MenuId 601
        'type'            => 'hotelroom4', //房型类别
        'bed'             => 'hotelroom5', //床位数
      //''                => 'hotelroom6', //
        'minprice'        => 'hotelroom7', //最低价
        'num'             => 'hotelroom8', //每晚可预定房间数
        'des'             => 'hotelroom9', //房型简介
        'pic'             => 'hotelroom10', //房型图片
        'scale'           => 'hotelroom11', //定金支付比例
        'dayprice'        => 'hotelroom12', //每天价格
        'pic1'            => 'hotelroom13', //房型图片1
        'dateprice'       => 'hotelroom14', //时间段价格
      //''                => 'hotelroom15', //
        'orderType'       => 'hotelroom16', //预定类型
        'setprice'        => 'hotelroom17', //价格设置
        'display_order'   => 'hotelroom18', //排序
    );
    protected $_validate = array(
        array('name',        'require',   '房型名称必须填写！'),
        array('bed',         'require',   '床位数必须填写！'),
        array('num',         'require',   '可预定房间数必须填写！'),
        array('innId',       'require',   '未指定客栈ID！'),
    );
    
    protected $_auto = array(
        array('menuId','601',Model::MODEL_INSERT,'string'),
    );
    
    public function _initialize() {
        parent::_initialize();
        $this->viewFields = array(
            $this->tableName => array_merge(
                array('_as'=>'room'),
                array('_type'=>'LEFT'),
                $this->_map_flip
            ),
            'classsys'=>array(
                'classsys1'=>'typeName',
                '_on'=>'room.hotelroom4=classsys.classsys0'
            )
        );
    }
}

?>